﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Yugi.Client;
namespace Yugi_Gui
{
	/// <summary>
	/// Interaction logic for MessageBoard.xaml
	/// </summary>
	public partial class MessageBoard : UserControl
	{
       
		public MessageBoard()
		{
			this.InitializeComponent();
            MyConsole.Invoker = this.AddText;
            VisualStateManager.GoToState(this, "Default", false);
		}


        public void AddTextLine(string text,bool notify)
        {
            Paragraph p = new Paragraph(new Run(text));
            p.LineHeight = 0.02;
            this.document.Blocks.Add(p);
            if(notify)
                VisualStateManager.GoToState(this, "Notify", true);
        }
        public void AddTextLine(string text)
        {
            Paragraph p = new Paragraph(new Run(text));
            p.LineHeight = 0.02;
            this.document.Blocks.Add(p);
        }
        public void AddText(string text)
        {
            Action p = () =>
            {
                AddTextLine(text);
            };
            this.Dispatcher.Invoke(p);
        }
        public void ClearAll()
        {
            document.Blocks.Clear();
        }
	}
}